package com.example.video.Enum;

public enum Language {

    /**
     * 中文
     */
    ZH("中文", "zh"),
    /**
     * 英文
     */
    EN("英文", "en");



    private final String name;
    private final String code;

    Language(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public String getCode() {
        return code;
    }

    public static String getCodeByName(String name) {
        for (Language language : Language.values()) {
            if (language.getName().equals(name)) {
                return language.getCode();
            }
        }
        return null;
    }

}
